<template>
	<view style="padding-bottom: 150rpx;">
		<!-- <page-head :title="'我的邀请'" :headtype="2"></page-head> -->
		<view class="invitelist">
			<view class="inviteitem flex marginAuto" v-for="(item,index) in datas" :key="index">
				<view class="inavatar">
					<image :src="apifun.serveimg+'headav.png'" mode=""></image>
				</view>
				<view class="inr">
					<view class="inr-title">{{ item.username }}</view>
					<view class="inr-time flex">
						<view class="inrt-title">注册时间</view>
						<view class="inrt-time">{{ item.create_time }}</view>
					</view>
				</view>
			</view>
		</view>
		<view class="yqbtn marginAuto" style="width:600rpx;">
			<uv-button text="查看我的邀请二维码" @click="apifun.navigate('/pages/my/qrcode')" :customStyle="{
				'background':'#0E71EB',
				'color':'#ffffff',
				'font-size':'30rpx',
				'width':'600rpx',
				'height':'100rpx',
				'border-radius':'20rpx'
			}"></uv-button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				apifun:this.apifun,
				page:1,
				datas:[]
			};
		},
		onLoad() {
			this.initData()
		},
		methods: {
			initData(){
				let sendData = {
					page:this.page,
					limit:this.apifun.limit
				};
				this.apifun.unirequest('/coach/user/getInviteUserList','post',sendData,(res)=>{
					if(res.code === 200){
						let datas = res.data;
						if(datas.data.length <= 0){
							this.page--;
							return false
						};
						this.datas = [...this.datas,...datas.data]
					}else{
						this.apifun.toast(res.msg)
					}
				})
			}
		},
		onPullDownRefresh() {
			this.page = 1;
			this.datas = [];
			this.initData();
			uni.stopPullDownRefresh();
		},
		onReachBottom() {
			this.page++;
			this.initData()
		},
	};
</script>
<style scoped lang="scss">
	.inviteitem{
		width: 650rpx;
		padding: 20rpx;
		background: #fff;
		border-radius: 20rpx;
		margin-bottom: 20rpx;
		.inavatar{
			width: 100rpx;
			height: 100rpx;
			image{
				width: 100rpx;
				height: 100rpx;
			}
		}
		.inr{
			width: 80%;
			margin-left: 20rpx;
			.inr-title{
				line-height: 50rpx;
				color: #333333;
				font-size: 28rpx;
			}
			.inr-time{
				height: 50rpx;
				.inrt-title{
					display: inline-block;
					padding: 0 20rpx;
					height: 50rpx;
					line-height: 50rpx;
					background:#53A8FA;
					color: #fff;
					font-size: 22rpx;
					border-top-left-radius: 100rpx;
					border-bottom-left-radius: 100rpx;
				}
				.inrt-time{
					display: inline-block;
					padding: 0rpx 20rpx;
					height: 50rpx;
					line-height: 50rpx;
					border-top-right-radius: 100rpx;
					border-bottom-right-radius: 100rpx;
					background:#D4F1FF;
					color:#666666;
				}
			}
		}
	}
	.yqbtn{
		position: fixed;
		bottom:20rpx;
		left: 50%;
		margin-left: -300rpx;
	}
</style>
